Skip to content

Conversation

@bcotrim
Copy link
Contributor

@bcotrim bcotrim commented Dec 19, 2025

Related issues

Proposed Changes

  • Add logPrefix option to executeCliCommand to identify which site the logs belong to
  • Capture stdout from CLI child processes and log in real-time with [CLI - {siteId}] prefix
  • Add logging for site create operations via CLI (cli-site-creator.ts)
  • Add logging for site start operations via CLI (cli-server-process.ts)
  • Add logging for WP-CLI command execution (site-server.ts)

This restores the logging behavior that was available before switching to CLI for site create/start operations, making debugging easier.

Testing Instructions

  1. npm start
  2. Create a site
  3. Verify logs appear in Studio console with prefix [CLI - {siteId}]
  4. Start a stopped site
  5. Verify startup logs appear in Studio console with the same prefix format
  6. Run a WP-CLI from the AI Assistant command on a running site
  7. Verify the command output appears in Studio console with the site ID prefix

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?

@bcotrim bcotrim self-assigned this Dec 19, 2025
@bcotrim bcotrim requested review from a team and fredrikekelund December 19, 2025 09:11
Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for improving the logging @bcotrim! 🙌

I confirm that I see the logs when adding or starting a site.

Image Image

However, I couldn't get the WP CLI output to get logged in the Studio console. In another tab, I tested listing the site plugins:

node dist/cli/main.js wp plugin list --path ~/Studio/my-wordpress-website-7

But I only see the output in the original tab.

@bcotrim
Copy link
Contributor Author

bcotrim commented Dec 22, 2025

@gcsecsey thanks for reviewing and testing.
Did you run those WP CLI from a terminal outside of Studio? If that's the case we don't capture those logs.
If you run the WP CLI from the Assistant tab for example, you should see the logs in Studio.
Sorry if the instructions weren't clear, I've updated them.

Copy link
Contributor

@gcsecsey gcsecsey left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@gcsecsey thanks for reviewing and testing. Did you run those WP CLI from a terminal outside of Studio? If that's the case we don't capture those logs. If you run the WP CLI from the Assistant tab for example, you should see the logs in Studio. Sorry if the instructions weren't clear, I've updated them.

Thanks @bcotrim for updating the steps. Yes indeed, earlier I tried running the CLI commands from another terminal tab. I now tested running it through the Assistant, and this works great, I can see the output in the console.

Image Image

@katinthehatsite
Copy link
Contributor

katinthehatsite commented Dec 23, 2025

Run a WP-CLI from the AI Assistant command on a running site

This testing step did not seem to work for me, I was getting errors on this branch when running commands in asisstant:

Screenshot 2025-12-23 at 10 26 43 AM

The rest worked as expected:

Screenshot 2025-12-23 at 10 22 30 AM

I approved the PR regardless as I don't think asisstant command failures are related to this.

Copy link
Member

@sejas sejas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works as described. I can see the logs in the console:

Logs

pp version: 1.6.7
Environment: development
Built from commit: dev
Local timezone: Europe/Madrid
App locale: en-US
System locale: en-US@rg=eszzzz
Used language: en
Setting Sentry user ID: 8.....10
Would have bumped stat: studio-app-launch-total=darwin
Would have bumped stat: studio-app-launch-uniques=darwin
WordPress latest folder already exists. Skipping download.
SQLite Command is up to date.
Starting server for 'SQLite 2.2.15'
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Loading site…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Starting process daemon...
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Setting up SQLite integration, if needed...
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Starting WordPress site...
Sentry Logger [log]: [Offline Store]: Popping envelope from offline storage
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Starting up workers…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Booting WordPress…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Running the Blueprint…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Finished running the Blueprint…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Preparing workers…
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] WordPress is running
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] Site URL:  http://localhost:8888
Username:  admin
Password:  eWtAUSVUNSN4WjdGSjlFUExQTWMwI3lz
Server started for 'SQLite 2.2.15'
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] {"name":"Twenty Twenty-Five","path":"\/wordpress\/wp-content\/themes\/twentytwentyfive","slug":"twentytwentyfive","isBlockTheme":true,"supportsWidgets":false,"supportsMenus":false}
[CLI - 2f62560c-5cfb-4c8e-a389-df468348dc80] {"name":"Twenty Twenty-Five","path":"\/wordpress\/wp-content\/themes\/twentytwentyfive","slug":"twentytwentyfive","isBlockTheme":true,"supportsWidgets":false,"supportsMenus":false}
(node:6104) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 exit listeners added to [process]. MaxListeners is 10. Use emitter.setMaxListeners() to increase limit
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] []
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] http://localhost:8892
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] http://localhost:8892
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] []
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] [{"name":"twentytwentyfive","status":"active","update":"none","version":"1.4","update_version":"","auto_update":"off"},{"name":"twentytwentyfour","status":"inactive","update":"none","version":"1.4","update_version":"","auto_update":"off"},{"name":"twentytwentythree","status":"inactive","update":"none","version":"1.6","update_version":"","auto_update":"off"}]
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] [{"name":"twentytwentyfive","status":"active","update":"none","version":"1.4","update_version":"","auto_update":"off"},{"name":"twentytwentyfour","status":"inactive","update":"none","version":"1.4","update_version":"","auto_update":"off"},{"name":"twentytwentythree","status":"inactive","update":"none","version":"1.6","update_version":"","auto_update":"off"}]
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] +---------+----------+--------+---------+----------------+-------------+
[CLI - 1bc690dc-03df-4807-b887-c8b07a178b1f] | name    | status   | update | version | update_version | auto_update |
+---------+----------+--------+---------+----------------+-------------+
| akismet | inactive | none   | 5.6     |                | off         |
| hello   | inactive | none   | 1.7.2   |                | off         |
| db.php  | dropin   |        |         |                | off         |
+---------+----------+--------+---------+----------------+-------------+

@sejas sejas merged commit 70f8bd5 into dev/studio-cli-i2 Dec 30, 2025
6 of 9 checks passed
@sejas sejas deleted the stu-1157-studio-add-site-createstart-logs-back-to-studio-logs branch December 30, 2025 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants